package com.xc.h05.controller.changlongfei;

import com.xc.h05.entity.CoursemarkCLFV;
import com.xc.h05.service.changlongfei.VCoursemarkService;
import com.xc.h05.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/vCoursemark")
public class VCoursemarkController {
    @Autowired
    private VCoursemarkService vCoursemarkService;
    @GetMapping("/getCoursemarkByPage")
    public R getCoursemarkByPage(int pageNum, int pageSize, CoursemarkCLFV coursemarkclfv){
        return R.ok(vCoursemarkService.getCoursemarkByPage(pageNum,pageSize,coursemarkclfv));
    }
//    删除
    @DeleteMapping("/deleteByPrimaryKey")
    public R deleteByPrimaryKey(Long id){
        int i = vCoursemarkService.deleteByPrimaryKey(id);
        if (i == 0){
            return R.ok("删除失败");
        }else {
            return R.ok("删除成功");
        }
    }
//    批量删除
    @DeleteMapping("/deleteCoursemarkBatch")
    public R deleteCoursemarkBatch(Long[] ids){
        int i = vCoursemarkService.deleteCoursemarkBatch(ids);
        if (i == 0){
            return R.ok("删除失败");
        }else  {
            return R.ok("删除成功");
        }
    }
}
